<?php
	$topic_id = $params[0];
	if($_SERVER["REQUEST_METHOD"]=='POST') {
		$title			= strip_tags($_POST['title']);
		$detail			= $_POST['detail'];
		$status			= $_POST['status']=='publish' ? '1': '0';
		$ip				= getUserIP();

		$sql = "UPDATE `tbl_webboard` SET `title` = '$title', `detail` = '$detail' , `status` = '$status' WHERE  `topic_id` = '$topic_id' LIMIT 1;";
		mysql_query($sql);
		redirect('../');
		exit;
	}

	$sql = "SELECT * FROM `tbl_webboard` WHERE `topic_id` = '$topic_id' LIMIT 1";
	$query = mysql_query($sql);
	while($result = mysql_fetch_assoc($query)) {
		$title			= $result['title'];
		$detail			= $result['detail'];
	}
	mysql_free_result($query);
 
 
	include 'ckeditor/ckeditor.php';
	include 'ckeditor/ckfinder/ckfinder.php';
	
	$ckeditor = new CKEditor();
	$ckeditor->returnOutput			= true;
	$ckeditor->basePath				= '/backend/ckeditor/';
 

	CKFinder::SetupCKEditor($ckeditor, '/backend/ckeditor/ckfinder/');
	$detailHTML = $ckeditor->editor('detail', $detail);
?>